package com.mrx.xfriendship.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

/**
 * @author : 肖康宁
 * @since : 2023-01-16 09:36
 **/
@Configuration
public class OtherConfig {

    @Bean
    public PasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder();
    }

    /**
     * 设置一个没用的 UserDetailService, 项目里并不会使用, 只是为了抑制警告
     */
    @Bean
    public UserDetailsService userDetailsService() {
        return username -> null;
    }

}
